<?php

/*
 * 文件说明.
 * 
 * @author Kun Xu <kunx@jumei.com>
 */

/**
 * Description of UserUploadFileFM
 *
 * @author 坤
 */
class UserUploadFileFM extends CFormModel
{

    public $user_id;
    public $bucket;

    public function rules()
    {
        return array(
            array('user_id', 'required'),
            array('bucket', 'length', 'min' => 2),
            array('user_id,bucket', 'safe'),
        );
    }

    public function attributeLabels()
    {
        return array(
            'user_id' => '用户id',
            'bucket' => '空间名称',
        );
    }

    public function getSearchFormConfig()
    {
        return array(
            'action' => Yii::app()->createUrl(Yii::app()->getController()->module->id . '/' . Yii::app()->getController()->id . '/' . Yii::app()->getController()->action->id), /* Yii::app()->request->url, */ //'/y1/index.php/admin/upyunadmin/list',
            'method' => 'get',
            'title' => '查询用户上传列表',
            'showErrorSummary' => true,
            'showErrors' => true,
            'activeForm' => array(
                'class' => 'bootstrap.widgets.TbActiveForm',
                'type' => 'inline',
            ),
            'elements' => array(
                'user_id' => array(
                    'type' => 'text',
                    'label' => '用户',
                    'hint' => '请输入用户id',
                    'enableAjaxValidation' => true,
                    'htmlOptions' => array(
                        'style' => 'margin-right:10px;',
                    ),
                ),
                'bucket' => array(
                    'type' => 'dropdownlist',
                    'items' => UserUploadFile::getBucketList(),
                    'prompt' => '--请选择--',
                    'htmlOptions' => array(
                    ),
                ),
            ),
            'buttons' => array(
                'submit' => array(
                    'type' => 'primary',
                    'buttonType' => 'submit',
                    'htmlOptions' => array('name' => 'submit'),
                    'label' => '查 询',
                ),
            ),
        );
    }

    public function getUploadForm()
    {
        return array(
            'method' => 'post',
            'title' => '修改记录',
        );
    }

}
